import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Vant from 'vant'
import 'vant/lib/index.css'
import axios from 'axios'
import VueAxios from 'vue-axios'
import { Sticky } from 'vant';
import { Search } from 'vant';


// 配置后端接口的统一前缀
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/';

// axios.interceptors.request.use(
//   config =>{
//     //自己在vuex中定义令牌属性，我这里叫token
//     let token = store.state.token
//     if(token){
//         //这里面获取的请求头的键(tokenHeader)根据每个后端的习惯封装的名称各不相同  
//       config.headers.common['cstoken'] = token
//     }
//     return config
//   }, error =>{
//     return Promise.reject(error)
//   }
// )

createApp(App).use(store).use(router).use(Vant).use(Sticky).use(VueAxios, axios).use(Search).mount('#app')